//
//  BigView.m
//  Run
//
//  Created by sxz on 16/4/1.
//  Copyright © 2016年 BetaTheta. All rights reserved.
//

#import "BigView.h"

@implementation BigView

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
    
}

- (void)createView {
    
    // 距离
    self.distanceNum = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width - 20, self.bounds.size.height * 0.2)];
    self.distanceNum.center = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2 - self.distanceNum.frame.size.height - 20);
    self.distanceNum.textAlignment = NSTextAlignmentCenter;
    self.distanceNum.text = @"--";
    self.distanceNum.font = [UIFont boldSystemFontOfSize:50];
    
    self.distance = [[UILabel alloc] initWithFrame:CGRectMake(self.distanceNum.frame.origin.x, self.distanceNum.frame.size.height + self.distanceNum.frame.origin.y, self.distanceNum.frame.size.width, 20)];
    self.distance.text = @"距离(公里)";
    self.distance.textAlignment = NSTextAlignmentCenter;
    self.distance.font = [UIFont systemFontOfSize:16];
    self.distance.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
    
    [self addSubview:self.distanceNum];
    [self addSubview:self.distance];
    
    // 时间
    self.timeNum = [[UILabel alloc] initWithFrame:CGRectMake(10, self.distance.frame.size.height + self.distance.frame.origin.y + 20, self.frame.size.width / 2 - 20, self.distanceNum.frame.size.height)];
    self.timeNum.textAlignment = NSTextAlignmentCenter;
    self.timeNum.text = @"--";
    self.timeNum.font = [UIFont boldSystemFontOfSize:30];
    
    self.time = [[UILabel alloc] initWithFrame:CGRectMake(self.timeNum.frame.origin.x, self.timeNum.frame.size.height + self.timeNum.frame.origin.y, self.timeNum.frame.size.width, self.distance.frame.size.height)];
    self.time.text = @"时长";
    self.time.textAlignment = NSTextAlignmentCenter;
    self.time.font = [UIFont systemFontOfSize:16];
    self.time.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
    
    [self addSubview:self.timeNum];
    [self addSubview:self.time];
    
    // 配速
    self.speedNum = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width / 2 + 10, self.timeNum.frame.origin.y, self.timeNum.frame.size.width, self.timeNum.frame.size.height)];
    self.speedNum.textAlignment = NSTextAlignmentCenter;
    self.speedNum.text = @"--";
    self.speedNum.font = [UIFont boldSystemFontOfSize:30];
    
    self.speed = [[UILabel alloc] initWithFrame:CGRectMake(self.speedNum.frame.origin.x, self.speedNum.frame.origin.y + self.speedNum.frame.size.height, self.speedNum.frame.size.width, self.time.frame.size.height)];
    self.speed.text = @"配速(分钟/公里)";
    self.speed.textAlignment = NSTextAlignmentCenter;
    self.speed.font = [UIFont systemFontOfSize:16];
    self.speed.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
    
    [self addSubview:self.speedNum];
    [self addSubview:self.speed];
    
    // 线
    self.line = [[UIView alloc] initWithFrame:CGRectMake(0, self.frame.size.height - 1, self.frame.size.width, 1)];
    self.line.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1.0];
    
    [self addSubview:self.line];
}

@end
